package define
{
	import mx.resources.IResourceManager;
	import mx.resources.ResourceManager;

	public class Localization
	{
		private static var _instance:Localization;

		private var _rm:IResourceManager;

		public static const LOCALE_ZH_CN:String = "zh_CN";
		public static const LOCALE_EN_US:String = "en_US";

		public function Localization(lock:SingletonLocker)
		{
			_instance = this;

			_rm = ResourceManager.getInstance();
			this.locale = LOCALE_ZH_CN;

			CharacterConst.initialize();
		}

		public static function get instance():Localization
		{
			if(_instance == null)
				new Localization(new SingletonLocker());
			return _instance;
		}

		// singleton
		public function set locale(value:String):void
		{
			_rm.localeChain = [value];
		}

		public function s(resourceName:String):String
		{
			return _rm.getString("localization", resourceName);
		}
		/* translator db
		update tblitem set type = "斧" where type like "Axe";
		update tblitem set type = "披风" where type like "Back";
		update tblitem set type = "弓" where type like "Bow";
		update tblitem set type = "布甲" where type like "Cloth";
		update tblitem set type = "弩" where type like "Crossbow";
		update tblitem set type = "匕首" where type like "Dagger";
		update tblitem set type = "手指" where type like "Finger";
		update tblitem set type = "拳套" where type like "Fist Weapon";
		update tblitem set type = "枪械" where type like "Gun";
		update tblitem set type = "副手" where type like "Held In Off-hand";
		update tblitem set type = "神像" where type like "Idol";
		update tblitem set type = "皮甲" where type like "Leather";
		update tblitem set type = "圣契" where type like "Libram";
		update tblitem set type = "锤" where type like "Mace";
		update tblitem set type = "锁甲" where type like "Mail";
		update tblitem set type = "颈部" where type like "Neck";
		update tblitem set type = "板甲" where type like "Plate";
		update tblitem set type = "长柄武器" where type like "Polearm";
		update tblitem set type = "盾牌" where type like "Shield";
		update tblitem set type = "符印" where type like "Sigil";
		update tblitem set type = "法杖" where type like "Staff";
		update tblitem set type = "剑" where type like "Sword";
		update tblitem set type = "投掷武器" where type like "Thrown";
		update tblitem set type = "图腾" where type like "Totem";
		update tblitem set type = "饰品" where type like "Trinket";
		update tblitem set type = "魔杖" where type like "Wand";

		update tblitem set slot = "单手" where slot like "One-Hand";
		update tblitem set slot = "双手" where slot like "Two-Hand";
		update tblitem set slot = "副手" where slot like "Off Hand";
		update tblitem set slot = "副手" where slot like "Held in Off-hand";
		update tblitem set slot = "远程" where slot like "Ranged";
		update tblitem set slot = "投掷武器" where slot like "Thrown";
		update tblitem set slot = "圣物" where slot like "Relic";
		update tblitem set slot = "头部" where slot like "Head";
		update tblitem set slot = "肩部" where slot like "Shoulder";
		update tblitem set slot = "胸部" where slot like "Chest";
		update tblitem set slot = "手部" where slot like "Hands";
		update tblitem set slot = "腿" where slot like "Legs";
		update tblitem set slot = "手腕" where slot like "Wrist";
		update tblitem set slot = "腰部" where slot like "Waist";
		update tblitem set slot = "脚" where slot like "Feet";
		update tblitem set slot = "背部" where slot like "Back";
		update tblitem set slot = "颈部" where slot like "Neck";
		update tblitem set slot = "手指" where slot like "Finger";
		update tblitem set slot = "饰品" where slot like "Trinket";
		*/
	}
}

class SingletonLocker
{

}